home *** CD-ROM | disk | FTP | other *** search
- #include <graphics.h>
-
- #ifndef shape_HPP
- #define shape_HPP
-
- class Shape {
- unsigned x, y;
- public:
- Shape(unsigned x = 0, unsigned y = 0)
- { this->x = x; this->y = y; }
- unsigned getx() { return x; }
- unsigned gety() { return y; }
- virtual void show(int xxpose = 0,
- int yxpose = 0, unsigned scale = 1) {}
- virtual ~Shape() {}
- };
-
- class Segment : public Shape {
- Shape ** shapes;
- unsigned shapeCount;
- public:
- Segment(unsigned x, unsigned y,
- unsigned shapeCount, .../* shapes */);
- // All shapes must be dynamically allocated!
- // Segment then owns these shapes for deletion
- // purposes.
- virtual void show(int xxpose = 0,
- int yxpose = 0, unsigned scale = 1);
- ~Segment();
- };
-
- class Circle : public Shape {
- protected:
- unsigned radius;
- public:
- Circle(unsigned radius
- = (unsigned) getmaxy()/8,
- unsigned x = 0, unsigned y = 0)
- : Shape((x?x:radius),(y?y:radius))
- { this->radius = radius; }
- virtual void show(int xxpose = 0,
- int yxpose = 0, unsigned scale = 1)
- {
- circle((int)getx()+xxpose,
- (int)gety()+yxpose,
- (int)(radius*scale));
- }
- };
-
- #endif